//
//  NovelSectionView.m
//  ChineseCollegeStudentsNetwork
//
//  Created by 魏苏扬 on 2018/8/9.
//  Copyright © 2018年 刘喆. All rights reserved.
//

#import "NovelSectionView.h"

@interface NovelSectionView()
@property (nonatomic, strong) UIView *verticalView;
@property (nonatomic, strong) UILabel *titleLabel;
@end

@implementation NovelSectionView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
        [self setupLayout];
    }
    return self;
}
#pragma mark- UI
- (void)setupUI{
    self.backgroundColor = UIColorFromRGBHex(0xF5f5f6);
    
    self.verticalView = [[UIView alloc] init];
    self.verticalView.backgroundColor = UIColorFromRGBHex(0x326fb8);
    
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
}

- (void)setupLayout{
    [self addSubview:self.verticalView];
    [self.verticalView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.size.mas_equalTo(CGSizeMake(1, 12));
        make.centerY.mas_equalTo(self);
    }];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.verticalView.mas_right).offset(5);
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(self.verticalView);
    }];
}

- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
